from datetime import date as d
import calendar as ca

a = d.today()#返回当天日期
print(a)
b = d(2021, 6, 30)  # 传入某天日期
print(b)
res = b-a
print(res)
print(res.days)#获取天数
w = d.isoweekday(a)#返回星期几，1~7
print(w)

print('***************练习1**************************')
c = d.today()
e = d.isoweekday(c)
#今天是
print('今天是：',c,'星期：',e)
f = d(2021,6,25)#考试时间
g = d(2021,6,30)#放假时间
ks = f-c
fj = g-c
print('距离考试还有：',ks.days,'天')
print('距离放假还有：',fj.days,'天')

print(ca.month(2021,5))#打印日历
print(ca.calendar(2021))#打印一整年的日历

print('****************练习2**************************************')
y = int(input('输入年份'))
m1 = int(input('起始月'))
m2 = int(input('结束月'))
if m1 == m2:
    print(ca.month(y,m1))
else:
    for i in range(m1,m2):
        print(ca.month(y,i+1))
        print('*'*20)

print('****************练习3**************************************')
partyDate = {
    '编程猫': date(2020, 3, 9),
    '渝小帅': date(2020, 4, 8),
    '温温': date(2020,5, 15),
    '欧阳涂涂': date(2020, 5, 21),
    '叶清秋': date(2020, 6, 14),
    '高欢': date(2020,8, 8),
    '边磊':date(2020,9, 11),
    '丛子柒': date(2020, 9, 20),
}
myList = []
for k, v in partyDate.items():
    week = d.isoweekday(v)
    if week == 3 or week == 7:
        myList.append(k+str(v))
print('可以去参加的生日party有: ' + ' '.join(myList))
